Initializes a new
CorrelationListCommand with explicit parameters.
Syntax
Parameters
- correlationImage
- RasterImage object that references the image(s) for which to search.
- points
- Array of Point objects to be updated with the starting points of the correlated areas.
- listIndex
- Array of integers to be updated with the indices of the images that match correlated areas.
- xStep
- Step size in the X direction (along image width), in pixels. For best results, use 1.
- yStep
- Step size in the Y direction (along image height), in pixels. For best results, use 1.
- threshold
- Value that indicates the correlation threshold, which is a measure of the association
necessary for two areas to be considered to be correlated. If the correlation value between an image in the list
and an area in the reference image is less than the correlation threshold they are uncorrelated.
Valid values range from 0 (zero resemblance) to 100 (perfect resemblance).
Example
Run the CorrelationListCommand on an image
Visual Basic | Copy Code |
---|
Public Sub CorrelationListConstructorExample()
RasterCodecs.Startup()
Dim codecs As RasterCodecs = New RasterCodecs()
codecs.ThrowExceptionsOnInvalidImages = True
Dim image As RasterImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Master.jpg")
Dim copyRectangle As CopyRectangleCommand = New CopyRectangleCommand()
Dim rc_cor As Rectangle = New Rectangle(327, 378, 22, 28)
copyRectangle.Rectangle = rc_cor
copyRectangle.Run(image)
Dim correlationImage As RasterImage = copyRectangle.DestinationImage.Clone()
rc_cor = New Rectangle(283, 378, 22, 28)
copyRectangle.Rectangle = rc_cor
copyRectangle.Run(image)
correlationImage.AddPage(copyRectangle.DestinationImage.Clone())
Dim points(30) As Point
Dim listIndex(30) As Integer
Dim command As CorrelationListCommand = New CorrelationListCommand(correlationImage, points, listIndex, 1, 1, 90)
command.Run(image)
RasterCodecs.Shutdown()
End Sub |
C# | Copy Code |
---|
public void CorrelationListConstructorExample() { // Load an image RasterCodecs.Startup(); RasterCodecs codecs = new RasterCodecs(); codecs.ThrowExceptionsOnInvalidImages = true; RasterImage image = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Master.jpg"); CopyRectangleCommand copyRectangle = new CopyRectangleCommand(); Rectangle rc_cor = new Rectangle(327, 378, 22, 28); copyRectangle.Rectangle = rc_cor; copyRectangle.Run(image); RasterImage correlationImage = copyRectangle.DestinationImage.Clone(); rc_cor = new Rectangle(283, 378, 22, 28); copyRectangle.Rectangle = rc_cor; copyRectangle.Run(image); correlationImage.AddPage(copyRectangle.DestinationImage.Clone()); Point[] points = new Point[30]; int[] listIndex = new int[30]; CorrelationListCommand command = new CorrelationListCommand(correlationImage, points, listIndex, 1, 1, 90); command.Run(image); RasterCodecs.Shutdown(); } |
Requirements
Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also